<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>库存不足提示</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../res/layuis/css/layui.css">
   <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
   <script type="text/javascript" src="../../res/layuis/layui.js" charset="utf-8"></script>
</head>
<body>
<div class="demoTable" style="margin-top: 10px;">
<table class="layui-table"  lay-filter="demo" id="lowStocks">
    <thead>
	      <tr>
	      <th lay-data="{align:'center'}">乐器名称</th>
	      <th lay-data="{align:'center'}">材料名称</th>
	      <th lay-data="{align:'center'}">所需材料</th>
	      <th lay-data="{align:'center'}">库存数量</th>
	    </tr>
	   </thead>
	   <tbody id="lowStocksTb">
	   
	   </tbody>
</table>
<script type="text/javascript">
/**
 * 从地址栏传值的代码
 * @param param
 * @returns
 */

function getParameter(param){
	var query = window.location.search;
	var iLen = param.length;
	var iStart = query.indexOf(param);
	if (iStart == -1)
		return "";
	iStart += iLen + 1;
	var iEnd = query.indexOf("&", iStart);
	if (iEnd == -1)
		return query.substring(iStart);
	return query.substring(iStart, iEnd);
}
 
 
$(function(){
	var dataText=getParameter("dataText");
	var dataTexts=new Array();
	
	dataTexts=dataText.split("*");
	
	for (var i = 0; i < dataTexts.length; i++) {
		if(dataTexts[i]){
			$("#lowStocksTb").append("<tr>"+
					 "<td>"+decodeURI(dataTexts[i].split(",")[0])+"</td>"+
					 "<td>"+decodeURI(dataTexts[i].split(",")[1])+"</td>"+
					 "<td>"+dataTexts[i].split(",")[2]+"</td>"+
					 "<td>"+dataTexts[i].split(",")[3]+"</td>"+
					 +"</tr>")
				 
}

		}
		
})

 
</script>
 
 </div>

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->

</body>
</html>